﻿@{
    ViewBag.Title = "Form"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'common', 'optimizeSelectOption'], function () {
        var form = layui.form,
            $ = layui.$,
            common = layui.common;
        var keyValue = $.request("keyValue");
        //权限字段
        common.authorizeFields('adminform');

        $(function () {
            initControl();
            if (!!keyValue) {
                common.ajax({
                    url: '/MaterialManage/Area/GetFormJson',
                    dataType: 'json',
                    data: { keyValue: keyValue },
                    async: false,
                    success: function (data) {
                        common.val('adminform', data);
                    }
                });
            }
            form.render();
        });
        wcLoading.close();

        function initControl() {
            $("#F_AreaType").bindSelect({
                data: top.clients.dataItems['Mes_AreaType'],
                id: "",
            });
        }

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var postData = data.field;
            if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
            if (!postData["F_NeedRule"]) postData["F_NeedRule"] = false;
            common.submitForm({
                url: '/MaterialManage/Area/SubmitForm?keyValue=' + keyValue,
                param: postData,
                success: function () {
                    common.parentreload('data-search-btn');
                }
            })
            return false;
        });
    });
</script>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">库区类型</label>
                    <div class="layui-input-block">
                        <select id="F_AreaType" name="F_AreaType" lay-verify="required" lay-search>
                            <option value="" selected>请选择</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">堆放类型</label>
                    <div class="layui-input-block">
                        <select id="F_StackType" name="F_StackType" lay-verify="required" lay-search>
                            <option value="true" selected>货架</option>
                            <option value="false" >叠加</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">库区编号</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_AreaCode" name="F_AreaCode" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入库区编号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label required">库位前缀位数</label>
                    <div class="layui-input-block">
                        <input type="text" id="F_Prefix" name="F_Prefix" autocomplete="off" maxlength="50" lay-verify="required|number" placeholder="请输入库位前缀位数" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label">选项</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
                        <input type="checkbox" name="F_NeedRule" id="F_NeedRule" checked="" value="true" title="先进先出">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text layui-hide">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
                    </div>
                </div>
                <div class="layui-form-item layui-hide">
                    <button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</body>

